﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using LightManager.Effects;

namespace LightManager
{
    internal sealed class Action
    {
        public Action(IGameEffect effect)
        {
            this.Effect = effect;
            this.Id = Guid.NewGuid();
        }

        public Guid Id { get; private set; }

        /// <summary>
        /// Effetto associato all'azione
        /// </summary>
        public IGameEffect Effect { get; private set; }

        /// <summary>
        /// Bersaglio dell'azione
        /// </summary>
        public Unit Target { get; set; }

        /// <summary>
        /// Nome di chi ha effettuato l'azione
        /// </summary>
        public string From { get; set; }

        /// <summary>
        /// Offset inizio in turni (0 = immediato)
        /// </summary>
        public int Countdown { get; set; }

        /// <summary>
        /// Numero di turni in cui l'azione è rimasta attiva
        /// </summary>
        public int InProgress { get; set; }

        /// <summary>
        /// Durata in turni
        /// </summary>
        public int Duration { get; set; }

        public string Perform()
        {
            return this.Effect.Perform(this.Target);
        }

        public string Undo()
        {
            return this.Effect.Undo(this.Target);
        }

        public bool IsTemporary
        {
            get { return this.Effect.IsTemporary; }
        }

        public bool IsOneShot
        {
            get { return this.Effect.IsOneShot; }
        }
    }
}
